﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Infrastructure.WpfClient.Views.Master;
//using Microsoft.Practices.Unity;
//using System.Windows.Data;
//using System.ComponentModel;
//using Skynet.BusinessEntities;
//using System.Windows.Markup;
//using System.Windows.Documents;

//namespace Skynet.C2SModule.Presenters
//{
//    public class CreateBookPresenter : MasterPresenter<Views.CreateBook.ICreateBookView>
//    {
//        [Dependency]
//        public BusinessLogic.BusinessComponents.IBCBooks BCBooks { get; set; }

//        [Dependency]
//        public BusinessLogic.BusinessComponents.IBCAuthors BCAuthors { get; set; }

//        [Dependency]
//        public BusinessLogic.BusinessComponents.IBCPublisher BCPublishers { get; set; }

//        [Dependency]
//        public BusinessLogic.BusinessComponents.IBCSubject BCSubjects { get; set; }



//        public ICollectionView Authors{get;set;}
//        public ICollectionView Publishers {get;set;}
//        public ICollectionView Subjects { get; set; }

//        private BusinessLogic.BusinessEntities.Book _WorkerBook;
//        public BusinessLogic.BusinessEntities.Book WorkerBook {
//            get { return this._WorkerBook; }
//            set { this._WorkerBook = value; }
//        }

        
//        public override void OnViewReady()
//        {

//            this.Authors = CollectionViewSource.GetDefaultView(this.BCAuthors.GetAll().ToList());
//            this.Publishers = CollectionViewSource.GetDefaultView(this.BCPublishers.GetAll().ToList());
//            this.Subjects = CollectionViewSource.GetDefaultView(this.BCSubjects.GetAll().ToList());
//            this.WorkerBook = new BusinessLogic.BusinessEntities.Book();
//            this.WorkerBook.PublicationDate = DateTime.Now;
//            this.WorkerBook.Id = Guid.NewGuid();
//            this.InvokePropertyChanged("WorkerBook");            
//            this.InvokePropertyChanged("Authors");
//            this.InvokePropertyChanged("Publishers");
//            this.InvokePropertyChanged("Subjects");
//        }
//        internal void SaveBook()
//        {            
//            this.WorkerBook.AuthorId = (this.Authors.CurrentItem as Author).Id;
//            this.WorkerBook.SubjectId = (this.Subjects.CurrentItem as Subject).Id;
//            this.WorkerBook.PublisherId = (this.Publishers.CurrentItem as Publisher).Id;
//            this.WorkerBook.Content = XamlWriter.Save(new FlowDocument() { IsOptimalParagraphEnabled = true, IsHyphenationEnabled = true });
//            this.BCBooks.Add(this.WorkerBook);
//            this.OnViewClose();
//        }
//    }
//}
